bpo-45383: Inherit MetaClass from bases in FromSpec API#28748
Merged
encukou merged 19 commits intopython:mainfrom Jun 9, 2022
Merged
bpo-45383: Inherit MetaClass from bases in FromSpec API#28748encukou merged 19 commits intopython:mainfrom
encukou merged 19 commits intopython:mainfrom
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This checks the bases of of a type created using the FromSpec
API to inherit the bases metaclasses. The MetaClasses alloc
function will be called as is done in
tp_newfor classescreated in Python.
I have tested that both tests fail on the dev branch without the fix. This doesn't explicitly test that using
tp_basesalso works (yet). It also doesn't test the allocation size, the way it is written if the metaclass is set correctly (through allocation), then the allocation should also be correct.(I have not done that, because that would require creating a MetaClass that extends the
PyHeaptType_Object. Certainly possible, but it seemed a bit much – although that is my secret agenda ;)).https://bugs.python.org/issue45383
__subclasses__is set correctlytp_basesalso worksCheck the allocation size?